chrome.contextMenus.create({
    "type": "normal",
    "checked": false,
    "id": "contextMenu-wurd-copy",
    "title": "wurd-copy",
    "contexts": ["all", "page", "selection", "image", "link"]
});
chrome.contextMenus.onClicked.addListener(function (info, tab, a, b, c) {
    console.log("#####");
    console.log(info, tab);
    chrome.cookies.getAll({ "url": info.pageUrl }, function (c) {
        console.log("chrome.cookies.getAll", c);
    });
    chrome.cookies.getAllCookieStores(function (c) {
        console.log("chrome.cookies.getAllCookieStores", c);
    });
    chrome.windows.getCurrent(function (tab) {
        console.log("chrome.windows.getCurrent", tab);
    });
    var o = 444, s = 555;
    chrome.windows.create({
        url: "show.html", left: Math.round((screen.width - o) / 2), top: Math.round((screen.height - s) / 2), width: o, height: s + 25, type: "popup"
    }, o => {
        chrome.tabs.sendRequest(o.tabs[0].id, wurd_current_tag, function (response) {
            console.log(response);
        })
    })

});
var wurd_current_tag = null;
chrome.runtime.onMessage.addListener(
    function (request, sender, sendResponse) {
        if (request.from == 'webUsage.js') {
            wurd_current_tag = request.content;
            sendResponse('success');
        } else if (request.from == 'show.html') {
            sendResponse(wurd_current_tag)
        } else {
            sendResponse('unsupport request.from');
        }
    }
);


//
// var notification = chrome.notifications.create("notification-start", {
//     type: 'basic',
//     title: ' ',
//     message: '启动了',
//     iconUrl: 'icon.png'
// });
